package com.jymj.service.impl;

import com.jymj.dao.PjTaskDelDao;
import com.jymj.entity.gantt.PjTaskDetEntity;
import com.jymj.service.PjTaskDelService;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by ljj on 2017/8/17.
 */
@Service("pjTaskDelService")
public class PjTaskDelServiceImpl implements PjTaskDelService {

    @Autowired
    private PjTaskDelDao pjTaskDelDao;

    @Override
    public void save(PjTaskDetEntity taskDetEntity) {
        pjTaskDelDao.save(taskDetEntity);
    }

    @Override
    public List<PjTaskDetEntity> queryList(Integer taskId) {
        return pjTaskDelDao.queryList(taskId);
    }

    @Override
    public List<PjTaskDetEntity> queryListOnlyTypeOne(Integer taskId) {
        Map<String, Object> map = new HashedMap();
        map.put("mstid", taskId);
        map.put("type", 1);
        return pjTaskDelDao.queryList1(map);
    }

    /**
     *
     * @param x
     * @param y
     * @param x1
     * @param y1
     * @param code
     * @return
     */
    @Override
    public List<PjTaskDetEntity> queryByRange(double x, double y, double x1, double y1, String code) {
        Map<String, Object> map = new HashedMap();
        map.put("lat", x);
        map.put("lat1", x1);
        map.put("lng", y);
        map.put("lng1", y1);
        map.put("code", code);
        return pjTaskDelDao.queryByRange(map);
    }

    /**
     * 获取项目图片 by DL 2017-10-09
     *
     *  pjid
     * @return
     */
    @Override
    public List<PjTaskDetEntity> queryPicForApp(String code) {
        Map<String, Object> map = new HashedMap();
        map.put("code", code);
        return pjTaskDelDao.queryPicForApp(map);
    }

    @Override
    public void upDate(PjTaskDetEntity pjTaskDetEntity) {
        pjTaskDelDao.update(pjTaskDetEntity);
    }

    @Override
    public void delete(Integer id) {
        pjTaskDelDao.delete(id);
    }

    @Override
    public PjTaskDetEntity queryObject(Integer id) {
        return pjTaskDelDao.queryObject(id);
    }
}
